import request from '@/utils/request'

const userApi = {
  Add: '/admin/user/add',       // 用户新增
  CheckPhoneCode: '/web/checkPhoneCode',       // 修改手机 校验短信验证码
  Detail: '/admin/user/detail',       // 用户详情
  GetPhoneCode: '/web/getPhoneCode',       // 获取短信验证码
  GetPhoneCodeByNew: '/web/getPhoneCodeByNew',       // 获取新号码的短信验证码
  GetPicCode: '/admin/getPicCode',       // 获取图形验证码
  List: '/admin/user/list',       // 列表
  userOpLogList: '/admin/opLog/list',       // 操作记录
  
  UserApplyUp: '/web/applyUp',       // 升级

  Login: '/admin/login',   // 用户登录
  LoginList: '/admin/loginLog/list',       // 登录记录
  UserLoginCheckCode: '/web/loginCheckCode',       // 登录提交手机号码
  Logout: '/admin/user/logout', // 注销
  Update: '/admin/user/update',       // 编辑

  UpdatePhone: '/web/updatePhone',       // 修改手机号码
  UpdateSelf: '/web/updateSelf',       // 用户自己编辑
  
  


  UserMsgList: '/web/userMsg/listByUser',       // 用户消息列表
  UserMsgRead: '/web/userMsg/read/add',       // 用户消息已读
  UserMsgReadAll: '/web/userMsg/read/all',       // 用户消息已读
  UserMsgUpdateLevel: '/web/userMsg/updateLevel', // 消息升级
  UserMsgPassOpStatus: '/web/userMsg/passOpStatus', // 消息操作-忽略操作
  
  
  

  UserThirdGetLoginUrl: '/web/userThird/getLoginUrl',       // 获取登录地址
  UserThirdGetThirdInfo: '/web/userThird/getThirdInfo',       // 获取三方信息

  UserUpdateSelfByPassword: '/web/updateSelfByPassword',       // 用户自己编辑-修改密码




  UserPayUpdate: '/web/userPay/update',       // 获取用户自己薪资构成
  UserPayEditUpdate: '/web/userPayEdit/update',       // 获取用户自己薪资构成

  FinanceLogAddBatch: '/web/financeLog/addBatch',       // 获取用户自己薪资构成
  
}

/**
 * login func
 * parameter: {
 *     username: '',
 *     password: '',
 *     remember_me: true,
 *     captcha: '12345'
 * }
 * @param parameter
 * @returns {*}
 */
export function login (parameter) {
  return request({
    url: userApi.Login,
    method: 'post',
    data: parameter,
  })
}
export function userLoginCheckCode (parameter) {
  return request({
    url: userApi.UserLoginCheckCode,
    method: 'post',
    data: parameter,
  })
}

export function userAdd (parameter) {
  return request({
    url: userApi.Add,
    method: 'post',
    data: parameter,
  })
}
export function userAddCgtw (parameter) {
  return request({
    url: userApi.AddCgtw,
    method: 'post',
    data: parameter,
  })
}
export function userDeleteCgtw (parameter) {
  return request({
    url: userApi.DeleteCgtw,
    method: 'post',
    data: parameter,
  })
}
export function userCheckPhoneCode (parameter) {
  return request({
    url: userApi.CheckPhoneCode,
    method: 'post',
    data: parameter,
  })
}
export function userGetPhoneCode (parameter) {
  return request({
    url: userApi.GetPhoneCode,
    method: 'post',
    data: parameter,
  })
}
export function userGetPhoneCodeByNew (parameter) {
  return request({
    url: userApi.GetPhoneCodeByNew,
    method: 'post',
    data: parameter,
  })
}

export function getInfo (parameter) {
  return request({
    url: userApi.Detail,
    method: 'post',
    data: parameter,
  })
}

export function getPicCode (parameter) {
  return request({
    url: userApi.GetPicCode,
    method: 'post',
    data: parameter,
  })
}
export function userUpdate (parameter) {
  return request({
    url: userApi.Update,
    method: 'post',
    data: parameter,
  })
}
export function userUpdatePhone (parameter) {
  return request({
    url: userApi.UpdatePhone,
    method: 'post',
    data: parameter,
  })
}
export function userUpdateSelf (parameter) {
  return request({
    url: userApi.UpdateSelf,
    method: 'post',
    data: parameter,
  })
}
export function userLoginList (parameter) {
  return request({
    url: userApi.LoginList,
    method: 'post',
    data: parameter,
  })
}

export function getUserList (parameter) {
  console.log(userApi.List)
  return request({
    url: userApi.List,
    method: 'post',
    data: parameter,
  })
}

export function getUserOpLogList (parameter) {
  return request({
    url: userApi.userOpLogList,
    method: 'post',
    data: parameter,
  })
}

export function getUserMsgList (parameter) {
  return request({
    url: userApi.UserMsgList,
    method: 'post',
    data: parameter,
  })
}
export function userMsgRead (parameter) {
  return request({
    url: userApi.UserMsgRead,
    method: 'post',
    data: parameter,
  })
}
export function userMsgReadAll (parameter) {
  return request({
    url: userApi.UserMsgReadAll,
    method: 'post',
    data: parameter,
  })
}
export function userMsgPassOpStatus (parameter) {
  return request({
    url: userApi.UserMsgPassOpStatus,
    method: 'post',
    data: parameter,
  })
}

export function userMsgUpdateLevel(parameter) {
  return request({
    url: userApi.UserMsgUpdateLevel,
    method: 'post',
    data: parameter,
  })
}

//  绑定微信
export function userThirdAdd (parameter) {
  return request({
    url: userApi.UserThirdAdd,
    method: 'post',
    data: parameter,
  })
}
//  解绑微信-管理员
export function userThirdDeleteByAdmin (parameter) {
  return request({
    url: userApi.UserThirdDeleteByAdmin,
    method: 'post',
    data: parameter,
  })
}
//  解绑微信-用户自己
export function userThirdDeleteByUser (parameter) {
  return request({
    url: userApi.UserThirdDeleteByUser,
    method: 'post',
    data: parameter,
  })
}
// 获取登录地址
export function userThirdGetLoginUrl (parameter) {
  return request({
    url: userApi.UserThirdGetLoginUrl,
    method: 'post',
    data: parameter,
  })
}
//  获取三方信息
export function userThirdGetThirdInfo (parameter) {
  return request({
    url: userApi.UserThirdGetThirdInfo,
    method: 'post',
    data: parameter,
  })
}

// 三方登录
export function userThirdLoginByThird (parameter) {
  return request({
    url: userApi.UserThirdLoginByThird,
    method: 'post',
    data: parameter,
  })
}

// 用户自己编辑-修改密码
export function userUpdateSelfByPassword (parameter) {
  return request({
    url: userApi.UserUpdateSelfByPassword,
    method: 'post',
    data: parameter,
  })
}
// 钉钉打卡  管理员查询
export function dingWorkInfo (parameter) {
  return request({
    url: userApi.DingWorkInfo,
    method: 'post',
    data: parameter,
  })
}

// 钉钉打卡 自己查询
export function dingWorkInfoBySelf (parameter) {
  return request({
    url: userApi.DingWorkInfoBySelf,
    method: 'post',
    data: parameter,
  })
}

// 新增-出勤标签
export function userWorkTagAdd (parameter) {
  return request({
    url: userApi.UserWorkTagAdd,
    method: 'post',
    data: parameter,
  })
}
// 编辑-出勤标签
export function userWorkTagUpdate (parameter) {
  return request({
    url: userApi.UserWorkTagUpdate,
    method: 'post',
    data: parameter,
  })
}

// 获取用户薪资构成
export function userPayGet (parameter) {
  return request({
    url: userApi.UserPayGet,
    method: 'post',
    data: parameter,
  })
}
  
  // 获取用户薪资构成 自己
  export function userPayGetBySelf (parameter) {
    return request({
      url: userApi.UserPayGetBySelf,
      method: 'post',
      data: parameter,
    })
  }

  
  // 获取用户薪资和考勤
  export function userPayGetUserPayByDay (parameter) {
    return request({
      url: userApi.UserPayGetUserPayByDay,
      method: 'post',
      data: parameter,
    })
  }
  
  // 获取用户自己月份薪资和考勤统计
  export function userPayGetUserPayByDaySelf (parameter) {
    return request({
      url: userApi.UserPayGetUserPayByDaySelf,
      method: 'post',
      data: parameter,
    })
  }
 // 编辑/新增
 export function userPayUpdate (parameter) {
  return request({
    url: userApi.UserPayUpdate,
    method: 'post',
    data: parameter,
  })
}
// 编辑/新增
export function userPayEditUpdate (parameter) {
  return request({
    url: userApi.UserPayEditUpdate,
    method: 'post',
    data: parameter,
  })
}
// 编辑/新增
export function financeLogAddBatch (parameter) {
  return request({
    url: userApi.FinanceLogAddBatch,
    method: 'post',
    data: parameter,
  })
}


export function logout () {
  return request({
    url: userApi.Logout,
    method: 'post',
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}

/**
 * get user 2step code open?
 * @param parameter {*}
 */
export function get2step (parameter) {
  return request({
    url: userApi.twoStepCode,
    method: 'post',
    data: parameter
  })
}

export function monthTaskGetMonthTask (parameter) {
  return request({
    url: userApi.MonthTaskGetMonthTask,
    method: 'post',
    data: parameter
  })
}
export function monthTaskGetMonthTaskBySelf (parameter) {
  return request({
    url: userApi.MonthTaskGetMonthTaskBySelf,
    method: 'post',
    data: parameter
  })
}

export function userApplyUp (parameter) {
  return request({
    url: userApi.UserApplyUp,
    method: 'post',
    data: parameter
  })
}


// /web/userMsg/passOpStatus


